from tensorflow import keras
from tensorflow.keras import utils
import tensorflow as tf
import numpy as np

x = tf.convert_to_tensor([1, 0, 3, 2, 2, 0, 0, 8])
print(x)
n_cls = tf.reduce_max(x) + 1

x = utils.to_categorical(x, n_cls)
print(x)
